from abc import ABC, abstractmethod

from chernc.treediff.gumtree.tree.tree import TreeLike


class Action(ABC):
    def __init__(self, node: TreeLike):
        self.node = node

    def get_node(self) -> TreeLike:
        return self.node

    def set_node(self, node: TreeLike) -> None:
        self.node = node

    @abstractmethod
    def get_name(self) -> str:
        pass

    def __eq__(self, other: object) -> bool:
        if self is other:
            return True
        if other is None:
            return False
        if not isinstance(other, Action):
            return False
        return self.node == other.node